package br.usp.poli.coop8.magapkg;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

@Entity
public class Exemplar implements Serializable {
	@Id
	private int idexemplar;

	@ManyToOne
	@JoinColumns({
		@JoinColumn(name="DATAEXEMPLAR", referencedColumnName="DATAEXEMPLAR"),
		@JoinColumn(name="IDPUBLICACAO", referencedColumnName="IDPUBLICACAO")
	})
	private Publicacao publicacao;

	@OneToMany(mappedBy="idexemplar")
	private Set<Emprestimo> emprestimoCollection;

	private static final long serialVersionUID = 1L;

	public Exemplar() {
		super();
	}

	public int getIdexemplar() {
		return this.idexemplar;
	}

	public void setIdexemplar(int idexemplar) {
		this.idexemplar = idexemplar;
	}

	public Publicacao getPublicacao() {
		return this.publicacao;
	}

	public void setPublicacao(Publicacao publicacao) {
		this.publicacao = publicacao;
	}

	public Set<Emprestimo> getEmprestimoCollection() {
		return this.emprestimoCollection;
	}

	public void setEmprestimoCollection(Set<Emprestimo> emprestimoCollection) {
		this.emprestimoCollection = emprestimoCollection;
	}

}
